package org.example.mybatis.service;


import org.example.mybatis.dao.UserAnnoMapper;
import org.example.mybatis.po.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 季舟
 * @Date 2025-02-06 13:16
 */
@Service
public class UserAnnoService {
    @Autowired
    private UserAnnoMapper userMapper;

    public List<User> findAll() {
        return userMapper.findAll();
    }

    public User findById(Long id) {
        return userMapper.findById(id);
    }

    public int save(User user) {
        if (user.getId() == null) {
            return userMapper.insert(user);
        } else {
            return userMapper.update(user);
        }
    }

    public int deleteById(Long id) {
        return userMapper.deleteById(id);
    }
}
